def solution(s: str) -> str:
    # write code here
    s = s.strip()
    if "." in s:
        s = format(float(s), ',')
    else:
        s = format(int(s), ',')
    return str(s)


if __name__ == '__main__':
    print(solution("1294512.12412") == '1,294,512.12412')
    print(solution("0000123456789.99") == '123,456,789.99')
    print(solution("987654321") == '987,654,321')